define(function(require, exports){
	// var $ = require('jquery');
	var pubjs = require('pubjs');
	var $ = require('jquery');
	var util = require('util');
	var grid = require('@base/grid').base;

	var Grid = grid.extend({
		init: function(config){
			config = pubjs.conf(config, {
				cols: [
					{name:'id',text:"ID", sort: false, width: 60, align: 'center'},
					{name:'Name', text: LANG("员工名称"), type:'index', width: 200, render:'renderName',align:'left'},
					{name:'Email', text: LANG("员工账号"), type:'index', width: 300, render:'renderName',align:'left'},
					{name:'Roles', text: LANG("角色"), render: 'renderRole',align:'center'},
				]
				,url: 'user/employeeList'
				,sub_field: 'id'
				,sort: 'id'
				,reqType: 'websocket'
				,opClick: true
				,hasTab: false
				,hasMenu: false
				,hasPager: true
				,hasSearch: true
				,hasExport: false
				,hasAmount: false
				,auto_load: true
				,hasSelect: true
				,hasRefresh: false
				,param: {
					// limit: 8
				}
				,pager: {
					// size: 8,
					//showSizeTypes: 0,
					//showJumper: 0
				}
				,'list':{
					'rowSelect': true,
					'scroll_type': 'row',
					'scroll_size': 10
				}
			});

			this.Super('init', arguments);
		}
		,renderName: function(i, val){
			return '<div class="uk-text-truncate tl" title="' + val + '">' + val + '</div>';
		}
		,renderRole: function(i, val, data, con){
			var result = [];
			if(val && val.length){
				util.each(val, function(item){
					if(item && item.name){
						result.push(item.name);
					}
				});
			}
			return result.length ? result.join('、') : '-';
		}
		,renderOperate: function(i, val) {
			return '<button data-op="select" class="btn btn-success">' + LANG('选择') + '</button>';
		}
	});

	exports.base = Grid;
})